

package vistas;

import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JTextField;

import controladores.CCategoria;
import controladores.CIngrediente;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VIngrediente extends javax.swing.JFrame {

    private controladores.CIngrediente control;

	private CIngrediente ingrediente;
	
    
    public VIngrediente(CIngrediente ingre) {
        super();
    	
    	initComponents();
    	ingrediente = ingre;
        reiniciar();
    }
   
    
    

    public void addListener(ActionListener escuchador){
        btnSalir.addActionListener(escuchador);
        btnActualizar.addActionListener(escuchador);
        btnCancelar.addActionListener(escuchador);
        btnBuscar.addActionListener(escuchador);
        btnRegistrar.addActionListener(escuchador);
      //  btnGenerar.addActionListener(escuchador);
        btnActualizar.setActionCommand("Actualizar");
        btnSalir.setActionCommand("Salir");
        btnCancelar.setActionCommand("Cancelar");
        btnBuscar.setActionCommand("Buscar");
        btnRegistrar.setActionCommand("Registrar");
   //     btnGenerar.setActionCommand("Generar");
    }

    public void mostrar(){
        txtCodigo.setEditable(false);
        txtStock.setEditable(false);
        txtDescripcion.setEditable(false);
        txtCantidad.setVisible(true);
        lblActualizar.setVisible(true);
        txtCantidad.setText("0");
    }

    public void reiniciar(){
        txtCodigo.setEditable(true);
        txtStock.setEditable(true);
        txtDescripcion.setEditable(true);
        txtCodigo.setText("");
        txtDescripcion.setText("");
        txtStock.setText("");
        txtStock.setEditable(true);
        txtCantidad.setVisible(false);
        lblActualizar.setVisible(false);
        txtCantidad.setText("0");
    }

    public JTextField getTxtCantidad() {
        return txtCantidad;
    }

    public JTextField getTxtCodigo() {
        return txtCodigo;
    }

    public JTextField getTxtDescripcion() {
        return txtDescripcion;
    }

    public JTextField getTxtStock() {
        return txtStock;
    }

    public ArrayList<JTextField> getEdits() {
        ArrayList<JTextField> v = new ArrayList<JTextField>();
        v.add(txtCodigo);
        v.add(txtCantidad);
        v.add(txtDescripcion);
        v.add(txtStock);
        return v;
    }



    public void setCodigo(String codigo){
    	txtCodigo.setText(codigo);
    }
    
    

    
    @SuppressWarnings("unchecked")
    
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        btnSalir = new javax.swing.JButton();
        btnCancelar = new javax.swing.JButton();
        btnRegistrar = new javax.swing.JButton();
        btnBuscar = new javax.swing.JButton();
        btnActualizar = new javax.swing.JButton();
        txtCodigo = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        txtDescripcion = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        txtStock = new javax.swing.JTextField();
        lblActualizar = new javax.swing.JLabel();
        txtCantidad = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Maestro de  Ingredientes");
        getContentPane().setLayout(null);

        jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel2.setLayout(null);

        btnSalir.setFont(new java.awt.Font("Andale Mono", 0, 15)); // NOI18N
        btnSalir.setText("Salir");
        jPanel2.add(btnSalir);
        btnSalir.setBounds(240, 80, 120, 50);

        btnCancelar.setFont(new java.awt.Font("Andale Mono", 0, 15)); // NOI18N
        btnCancelar.setText("Cancelar");
        btnCancelar.setPreferredSize(new java.awt.Dimension(80, 30));
        jPanel2.add(btnCancelar);
        btnCancelar.setBounds(90, 80, 120, 50);

        btnRegistrar.setFont(new java.awt.Font("Andale Mono", 0, 15)); // NOI18N
        btnRegistrar.setText("Registrar");
        btnRegistrar.setPreferredSize(new java.awt.Dimension(80, 30));
        jPanel2.add(btnRegistrar);
        btnRegistrar.setBounds(10, 20, 120, 50);

        btnBuscar.setFont(new java.awt.Font("Andale Mono", 0, 15)); // NOI18N
        btnBuscar.setText("Buscar");
        btnBuscar.setPreferredSize(new java.awt.Dimension(80, 30));
        jPanel2.add(btnBuscar);
        btnBuscar.setBounds(160, 20, 120, 50);

        btnActualizar.setFont(new java.awt.Font("Andale Mono", 0, 15)); // NOI18N
        btnActualizar.setText("Actualizar");
        btnActualizar.setPreferredSize(new java.awt.Dimension(80, 30));
        jPanel2.add(btnActualizar);
        btnActualizar.setBounds(300, 20, 130, 50);

        getContentPane().add(jPanel2);
        jPanel2.setBounds(30, 210, 470, 140);
        jPanel2.setBackground(new java.awt.Color(168,217,237));

        getContentPane().add(txtCodigo);
        txtCodigo.setBounds(250, 30, 130, 28);

        jLabel6.setFont(new java.awt.Font("Andale Mono", 0, 15)); // NOI18N
        jLabel6.setText("Codigo:");
        getContentPane().add(jLabel6);
        jLabel6.setBounds(80, 30, 130, 30);

        jLabel1.setFont(new java.awt.Font("Andale Mono", 0, 15)); // NOI18N
        jLabel1.setText("Descripcion:");
        getContentPane().add(jLabel1);
        jLabel1.setBounds(80, 70, 140, 32);

        txtDescripcion.setFont(new java.awt.Font("Arial", 0, 13)); 
        getContentPane().add(txtDescripcion);
        txtDescripcion.setBounds(250, 70, 130, 32);

        jLabel5.setFont(new java.awt.Font("Andale Mono", 0, 15)); 
        jLabel5.setText("Stock:");
        getContentPane().add(jLabel5);
        jLabel5.setBounds(80, 110, 130, 30);

        txtStock.setFont(new java.awt.Font("Arial", 0, 13));
        getContentPane().add(txtStock);
        txtStock.setBounds(250, 110, 130, 30);

        lblActualizar.setFont(new java.awt.Font("Andale Mono", 0, 15)); 
        lblActualizar.setText("Actualizar:");
        getContentPane().add(lblActualizar);
        lblActualizar.setBounds(80, 150, 140, 30);

        txtCantidad.setFont(new java.awt.Font("Arial", 0, 13)); 
        txtCantidad.setText("0");
        getContentPane().add(txtCantidad);
        txtCantidad.setBounds(250, 150, 130, 30);

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        this.setBounds(0, 0, 539, 406);
        getContentPane().setBackground(new java.awt.Color(230,238,250));
    }

    
    private javax.swing.JButton btnActualizar;
    private javax.swing.JButton btnBuscar;
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnRegistrar;
    private javax.swing.JButton btnSalir;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JLabel lblActualizar;
    private javax.swing.JTextField txtCantidad;
    private javax.swing.JTextField txtCodigo;
    private javax.swing.JTextField txtDescripcion;
    private javax.swing.JTextField txtStock;
   

}
